Crate sn_networking

source ·

Structs

  • API to interact with the underlying Swarm
  • Pretty print a kad::RecordKey as a hex string. So clients can use the hex string for xorname and record keys interchangeably. This makes errors actionable for clients. The only cost is converting ked::RecordKey into it before sending it in errors: record_key.into()
  • SwarmDriver is responsible for managing the swarm of peers, handling swarm events, processing commands, and maintaining the state of pending tasks. It serves as the core component for the network functionality.
  • Snapshot of information kept in the Swarm’s local state

Enums

  • Internal error.
  • Channel to send the Response through.
  • Events forwarded by the underlying Network; to be used by the upper layers

Constants

  • The maximum number of peers to return in a GetClosestPeers response. This is the group size used in safe network protocol to be responsible for an item in the network. The peer should be present among the CLOSE_GROUP_SIZE if we’re fetching the close_group(peer)
  • Our agent string has as a prefix that we can match against.

Functions

  • Majority of a given group (i.e. > 1/2).
  • Verifies if Multiaddr contains IPv4 address that is not global. This is used to filter out unroutable addresses from the Kademlia routing table.
  • Sort the provided peers by their distance to the given NetworkAddress. Return with the closest expected number of entries if has.
  • Sort the provided peers by their distance to the given KBucketKey. Return with the closest expected number of entries if has.